<%-- 
    Document   : detailPenelitian
    Created on : Oct 6, 2012, 2:04:54 PM
    Author     : user
--%>

<%@page import="Entity.PenelitiEksternal"%>
<%@page import="Entity.MahasiswaPeneliti"%>
<%@page import="Entity.DosenPeneliti"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@include file="../header.jsp"%>
<!DOCTYPE html>
<!-- start content-outer -->
<div id="content-outer"><!-- start content -->
    <div id="content">
        <div id="page-heading">
            <h1>Detail Penelitian</h1>
        </div>
        <table id="content-table" border="0" cellpadding="0" cellspacing="0" width="100%">
            <tbody>
                <tr>
                    <th rowspan="3" class="sized"><img src="images/shared/side_shadowleft.jpg" alt="" height="300" width="20" /></th>
                    <th class="topleft"></th>
                    <td id="tbl-border-top">&nbsp;</td>
                    <th class="topright"></th>
                    <th rowspan="3" class="sized"><img src="images/shared/side_shadowright.jpg" alt="" height="300" width="20" /></th>
                </tr>
                <tr>
                    <td id="tbl-border-left"></td>
                    <td><!-- start content-table-inner -->
                        <div id="content-table-inner">
                            <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                <tbody>
                                    <tr valign="top">
                                        <td>
                                            <!-- start step-holder -->
                                            <script>
                                                function validateForm()
                                                {   
                                                    var status = true, ketValid= true;
                                            
                                                    if(document.frm.status.value=="")
                                                    {                                                
                                                        document.getElementById("status_error").innerHTML="<div class='error-left'></div><div class='error-inner'>Status Penelitian Belum Terpilih.</div>";
                                                        status = false;
                                                    } else {
                                                        document.getElementById("status_error").innerHTML="";       
                                                    }
                                                    
                                                    if(document.frm.status.value=="2")
                                                    {
                                                        if(document.frm.ketValid.value=="")
                                                        {
                                                            document.getElementById("ketValid_error").innerHTML="<div class='error-left'></div><div class='error-inner'>Keterangan validasi belum diisi.</div>";
                                                            ketValid = false;
                                                        }else {
                                                            document.getElementById("ketValid_error").innerHTML="";
                                                        }                                                
                                                    } 
                                            
                                                    if(status && ketValid ){
                                                        return true;
                                                    }else{
                                                        return false;
                                                    }   
        
                                                }
                                            </script>
                                            <!-- end step-holder -->

                                            <!-- start id-form -->
                                            <form id="postform" name="frm" method="post" action="validasiPenelitian" id="postform" onsubmit="return validateForm()">
                                                <input type="hidden" name="noPenelitian" id="noPenelitian" value="${penelitian.noPenelitian}"/>
                                                <table id="id-detail" border="0" cellpadding="0" cellspacing="0" width="100%">
                                                    <tbody>
                                                        <tr>
                                                            <th width="300" valign="top">Judul Penelitian</th>
                                                            <td width="29" valign="middle" align="center">:</td>
                                                            <td width="500">${penelitian.judulPenelitian}</td>
                                                            <td></td>
                                                        </tr>            

                                                        <tr>
                                                            <th valign="top">Dana yang Diterima</th>
                                                            <td valign="middle" align="center">:</td>
                                                            <td><fmt:formatNumber value="${penelitian.danaDiterima}" type="currency" currencyCode="IDR"/></td>
                                                            <td></td>
                                                        </tr>
                                                        <tr>
                                                            <th valign="top">Sumber Penadanaan / Program Pendanaan</th>
                                                            <td valign="middle" align="center">:</td>        
                                                            <td>${penelitian.sumberDana.sumberPendanaan}</td>
                                                            <td></td>
                                                        </tr>
                                                        <tr>
                                                            <th valign="top">Tanggal Pelaksanaan</th>
                                                            <td valign="middle" align="center">:</td>
                                                            <td><c:set var="now" value="<%=new java.util.Date()%>" />
                                                                <fmt:parseDate value="${penelitian.tanggalPenelitianDimulai}" var="parsedTanggalMulai" pattern="yyyy-MM-dd" />
                                                                <fmt:formatDate type="date" dateStyle="long" value="${parsedTanggalMulai}"/> 
                                                                s.d 
                                                                <fmt:parseDate value="${penelitian.tanggalPenelitianSelesai}" var="parsedTanggalSelesai" pattern="yyyy-MM-dd" />
                                                                <fmt:formatDate type="date" dateStyle="long" value="${parsedTanggalSelesai}"/> 
                                                            </td>
                                                            <td></td>
                                                        </tr>
                                                        <tr>
                                                            <th valign="top">Laporan Penelitian</th>
                                                            <td valign="middle" align="center">:</td>
                                                            <td><c:if test="${(penelitian.lampiranLaporan == null)}">
                                                                    <label> -- </label>
                                                                </c:if>
                                                                <c:if test="${(penelitian.lampiranLaporan != null)}">
                                                                    <a href="downloadFile?fileLapPenelitian=${penelitian.lampiranLaporan}">${penelitian.lampiranLaporan}</a>
                                                                </c:if> 
                                                            </td>
                                                            <td></td>
                                                        </tr>
                                                        <tr>
                                                            <th valign="top">Ketua Tim Penelitian</th>
                                                            <td valign="middle" align="center">:</td>
                                                            <td>${penelitian.ketuaPeneliti}</td>
                                                            <td></td>
                                                        </tr>
                                                        <tr>
                                                            <th valign="top">Anggota Tim Dosen</th>
                                                            <td valign="top" align="center">:</td>
                                                            <%
                                                                ArrayList<DosenPeneliti> dosenPeneliti = new ArrayList();
                                                                dosenPeneliti = (ArrayList) request.getAttribute("listDosenPeneliti");
                                                                if (dosenPeneliti.size() > 0) {
                                                            %>
                                                            <td>
                                                                <table>

                                                                    <c:forEach items="${listDosenPeneliti}" var="listDosenPeneliti">
                                                                        <tr>
                                                                            <td>${listDosenPeneliti.dosen.user.namaUser}, NIP : ${listDosenPeneliti.dosen.user.idUser}</td>
                                                                            <td>&nbsp;</td>
                                                                            <td>
                                                                                <%
                                                                                    ArrayList listRole3 = new ArrayList();
                                                                                    listRole3 = (ArrayList) session.getAttribute("role");
                                                                                    int count3;
                                                                                    String role3;

                                                                                    for (count3 = 0; count3 < listRole3.size(); count3++) {
                                                                                        role3 = (String) listRole3.get(count3);
                                                                                        if (role3.equals("koordinator_ppm")) {
                                                                                %>
                                                                                <c:if test="${(penelitian.statusPenelitian != '0')}">
                                                                                    <a href="hapusDosenPeneliti?noPenelitian=${penelitian.noPenelitian}&&idUser=${listDosenPeneliti.dosen.user.idUser}" onClick="return confirm('Apakah anda yakin untuk menghapus?')"><img src="images/shared/b_drop.png" title="hapus"/></a>
                                                                                    </c:if>    
                                                                                    <%  }
                                                                                        }%>
                                                                            </td>
                                                                        </tr>
                                                                    </c:forEach>
                                                                </table>
                                                            </td>
                                                            <% } else {%>
                                                            <td><label>Tim Dosen Peneliti Belum Terdata</label></td>
                                                            <% }%>
                                                            <td></td>
                                                        </tr>
                                                        <%
                                                            ArrayList listRole3 = new ArrayList();
                                                            listRole3 = (ArrayList) session.getAttribute("role");
                                                            int count3;
                                                            String role3;

                                                            for (count3 = 0; count3 < listRole3.size(); count3++) {
                                                                role3 = (String) listRole3.get(count3);
                                                                if (role3.equals("koordinator_ppm")) {
                                                        %>
                                                        <c:if test="${(penelitian.statusPenelitian != '0')}">
                                                            <tr>
                                                                <td valign="top"></td>
                                                                <td valign="middle" align="center"></td>
                                                                <td><a href="tambahDosenPeneliti?noPenelitian=${penelitian.noPenelitian}">[Tambah tim dosen peneliti]</a></td>
                                                                <td></td>
                                                            </tr>
                                                        </c:if>
                                                        <% }
                                                            }%>
                                                        <tr>
                                                            <th valign="top">Anggota Peneliti Eksternal</th>
                                                            <td valign="top" align="center">:</td>
                                                            <%
                                                                ArrayList<PenelitiEksternal> penelitiEks = new ArrayList();
                                                                penelitiEks = (ArrayList) request.getAttribute("listPenelitiEks");
                                                                if (penelitiEks.size() > 0) {
                                                            %>
                                                            <td>
                                                                <table>

                                                                    <c:forEach items="${listPenelitiEks}" var="listPenelitiEks">
                                                                        <tr>
                                                                            <td>${listPenelitiEks.namaPeneliti}</td>
                                                                            <td>&nbsp;</td>
                                                                            <td>
                                                                                <%
                                                                                    for (count3 = 0; count3 < listRole3.size(); count3++) {
                                                                                        role3 = (String) listRole3.get(count3);
                                                                                        if (role3.equals("koordinator_ppm")) {
                                                                                %>
                                                                                <c:if test="${(penelitian.statusPenelitian != '0')}">
                                                                                    <a href="hapusAnggotaPenelitiEksternal?noPenelitian=${penelitian.noPenelitian}&&idPeneliti=${listPenelitiEks.idPenelitiEksternal}" onClick="return confirm('Apakah anda yakin untuk menghapus?')"><img src="images/shared/b_drop.png" title="hapus"/></a>   
                                                                                    </c:if>    
                                                                                    <%  }
                                                                                    }%>
                                                                            </td>
                                                                        </tr>
                                                                    </c:forEach>
                                                                </table>
                                                            </td>                                                        
                                                        <% } else {%>
                                                        <td><label>Tim Peneliti Eksternal Tidak Ada</label></td>
                                                        <% }%>
                                                            <td></td>
                                                        </tr>
                                                        <%

                                                            for (count3 = 0; count3 < listRole3.size(); count3++) {
                                                                role3 = (String) listRole3.get(count3);
                                                                if (role3.equals("koordinator_ppm")) {
                                                        %>
                                                        <c:if test="${(penelitian.statusPenelitian != '0')}">
                                                            <tr>
                                                                <td valign="top"></td>
                                                                <td valign="middle" align="center"></td>
                                                                <td><a href="tambahAnggotaPenelitiEksternal?noPenelitian=${penelitian.noPenelitian}">[Tambah anggota peneliti eksternal]</a></td>
                                                                <td></td>
                                                            </tr>
                                                        </c:if>
                                                        <%         }
                                                                }
                                                        %>
                                                        <tr>
                                                            <th valign="top">Anggota Tim Mahasiswa</th>
                                                            <td valign="top" align="center">:</td>
                                                            <%
                                                                ArrayList<MahasiswaPeneliti> mhsPeneliti = new ArrayList();
                                                                mhsPeneliti = (ArrayList) request.getAttribute("listMhsPeneliti");
                                                                if (mhsPeneliti.size() > 0) {
                                                            %>
                                                            <td>
                                                                <table>

                                                                    <c:forEach items="${listMhsPeneliti}" var="listMhsPeneliti">
                                                                        <tr>
                                                                            <td>${listMhsPeneliti.namaMahasiswa} (${listMhsPeneliti.nrpMahasiswa}), Judul Tugas Akhir : ${listMhsPeneliti.judulTugasAkhir}</td>
                                                                            <td>&nbsp;</td>
                                                                            <td>
                                                                                <%


                                                                                    for (count3 = 0; count3 < listRole3.size(); count3++) {
                                                                                        role3 = (String) listRole3.get(count3);
                                                                                        if (role3.equals("koordinator_ppm")) {
                                                                                %>  
                                                                                <c:if test="${(penelitian.statusPenelitian != '0')}">
                                                                                    <a href="hapusMhsPelaksanaPenelitian?noPenelitian=${penelitian.noPenelitian}&&idAnggota=${listMhsPeneliti.idMahasiswaPeneliti}" onClick="return confirm('Apakah anda yakin untuk menghapus?')"><img src="images/shared/b_drop.png" title="hapus"/></a></td>
                                                                                    </c:if>
                                                                                    <% }
                                                                                        }%>
                                                                        </tr>
                                                                    </c:forEach>
                                                                </table>
                                                            </td>

                                                            <% } else {%>
                                                            <td><label>Tim Mahasiswa Belum Terdata</label></td>
                                                            <% }%>
                                                            <td></td>
                                                        </tr>
                                                        <%
                                                            for (count3 = 0; count3 < listRole3.size(); count3++) {
                                                                role3 = (String) listRole3.get(count3);
                                                                if (role3.equals("koordinator_ppm")) {
                                                        %> 
                                                        <c:if test="${(penelitian.statusPenelitian != '0')}">
                                                            <tr>
                                                                <td valign="top"></td>
                                                                <td valign="middle" align="center"></td>
                                                                <td><a href="tambahMhsPelaksanaPenelitian?noPenelitian=${penelitian.noPenelitian}">[Tambah mahasiswa anggota penelitian]</a></td>
                                                                <td></td>
                                                            </tr>
                                                        </c:if>
                                                        <% }
                                                            }%>
                                                        <tr>
                                                            <td valign="top">&nbsp;</td>
                                                            <td valign="middle" align="center">&nbsp;</td>
                                                            <td>&nbsp;</td>
                                                            <td>&nbsp;</td>
                                                        </tr>
                                                        <c:if test="${(penelitian.statusPenelitian != '1')}">
                                                            <tr>
                                                                <th valign="top">Validasi Penelitian</th>
                                                                <td valign="middle" align="center">&nbsp;</td>
                                                                <td>&nbsp;</td>
                                                                <td>&nbsp;</td>
                                                            </tr>
                                                            <tr>
                                                                <th valign="top">Status Penelitian <font color="red">*</font></th>
                                                                <td valign="middle" align="center">:</td>
                                                                <td>
                                                                    <select name="status" id="status" class="styledselect_form_1">
                                                                        <option value="">- Belum Divalidasi -</option>
                                                                        <option value="1">- Valid -</option>
                                                                        <option value="2">- Tidak Valid -</option>
                                                                    </select>
                                                                </td>
                                                                <td id="status_error">
                                                                </td>
                                                            </tr>
                                                            <tr>
                                                                <th valign="top">Keterangan Validitas</th>
                                                                <td width="15">:</td>
                                                                <td><textarea name="ketValid" cols="" rows="" class="form-textarea" id="judul"></textarea>                                                
                                                                </td>
                                                                <td id="ketValid_error">
                                                                    <div class="bubble-left"></div>
                                                                    <div class="bubble-inner">Wajib diisi jika data tidak valid!</div>
                                                                    <div class="bubble-right"></div>   
                                                                </td>
                                                            </tr>                                                    
                                                            <tr>
                                                                <th>&nbsp;</th>
                                                                <td></td>
                                                                <td valign="top">
                                                                    <input type="submit" value="" class="form-validasi" />
                                                                    <input type="button" value="" class="form-kembali" onClick="history.go(-1);"/>
                                                                </td>
                                                                <td></td>
                                                            </tr>
                                                        </c:if>
                                                    </tbody>
                                                </table>
                                            </form>
                                            <!-- end id-form --> </td>
                                        <td><!-- start related-activities --><!-- end related-activities --></td>
                                    </tr>
                                    <tr>
                                        <td><img src="../images/shared/blank.gif" alt="blank" height="1" width="695" /></td>
                                        <td></td>
                                    </tr>
                                </tbody>
                            </table>
                            <div class="clear"></div>
                        </div>
                        <!-- end content-table-inner -->
                    </td>
                    <td id="tbl-border-right"></td>
                </tr>
                <tr>
                    <th class="sized bottomleft"></th>
                    <td id="tbl-border-bottom">&nbsp;</td>
                    <th class="sized bottomright"></th>
                </tr>
            </tbody>
        </table>
        <div class="clear">&nbsp;</div>
    </div>
    <!-- end content -->
    <div class="clear">&nbsp;</div>
</div>
<!-- end content-outer -->
<div class="clear">&nbsp;</div>
<%@include file="../footer.jsp"%>

